package edu.whu.xterm.widget;

import android.text.Spannable;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.widget.SimpleAdapter.ViewBinder;
import android.widget.TextView;

public class SpannableViewBinder implements ViewBinder {

	@Override
	public boolean setViewValue(View view, Object data, String textRepresentation) {
		if (view instanceof TextView && data instanceof Spannable) {
			((TextView) view).setText((CharSequence) data);
			((TextView) view).setMovementMethod(LinkMovementMethod.getInstance());
			view.setFocusable(false);
			view.setFocusableInTouchMode(false);
			return true;
		}
		return false;
	}

}
